<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var date = new Date();
        // var date = new Date(2022,9,28,12,25,40); // 月份取值为[0,11]
        // var date = new Date(456455675443);

        console.log(date);

        let year = date.getFullYear();
        let month = date.getMonth()+1;
        let d = date.getDate();
        let hour = date.getHours();
        let minute = date.getMinutes();
        let second = date.getSeconds();
        let milliseconds = date.getMilliseconds();
        let day = date.getDay();
        var weekday = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六']
        let time = date.getTime();

        var currentTime = year+"年"+checkDate(month)+"月"+checkDate(d)+"日 "+checkDate(hour)+":"+checkDate(minute)+":"+checkDate(second)+" " + milliseconds+" "+weekday[day]
        console.log(currentTime);
        console.log(time);


        function checkDate(num){
            return num<=9 ? '0'+num : num
        }



    </script>
</head>
<body>

</body>
</html>